﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using WaterRevenueMS.Componnent.Common;

using WaterRevenueMS.Componnent.Entities.BasicSet;
using WaterRevenueMS.Core.Repository.BasicSet;
using WaterRevenueMS.Domain.ViewModels.BasicSet;

namespace WaterRevenueMS.Core.Service.BasicSet.Impl
{
    [Export(typeof(IHandSetTypeService))]
    public class HandSetTypeService : CoreServiceBase, IHandSetTypeService
    {
        [Import]
        public IHandSetTypeRepository HandSetTypeRepository { get; set; }

        public IQueryable<Componnent.Entities.BasicSet.HandSetType> HandSetTypes
        {
            get { return HandSetTypeRepository.Entities; }
        }

        public Componnent.Common.OperationResult Insert(Domain.ViewModels.BasicSet.HandSetType.HandSetTypeModel model)
        {
            var entity = new HandSetType
            {

                Shou_CQLX = model.Shou_CQLX,
                Shou_CQXH = model.Shou_CQXH,
                CreateDT = DateTime.Now,
                Tong_XDK = model.Tong_XDK,

                Bo_TL = model.Bo_TL,
                Jiao_YFS = model.Jiao_YFS,
                Shu_JW = model.Shu_JW,
                Ting_ZW = model.Ting_ZW,
                Wo_SXY = model.Wo_SXY

            };
            HandSetTypeRepository.Insert(entity);
            return new OperationResult(OperationResultType.Success, "添加成功");
        }

        public Componnent.Common.OperationResult Update(Domain.ViewModels.BasicSet.HandSetType.HandSetTypeModel model)
        {
            var entity = new HandSetType
            {
                Id = model.Id,
                Shou_CQLX = model.Shou_CQLX,
                Shou_CQXH = model.Shou_CQXH,
                CreateDT = DateTime.Now,
                Tong_XDK = model.Tong_XDK,

                Bo_TL = model.Bo_TL,
                Jiao_YFS = model.Jiao_YFS,
                Shu_JW = model.Shu_JW,
                Ting_ZW = model.Ting_ZW,
                Wo_SXY = model.Wo_SXY,

                ReviseDT = DateTime.Now
            };
            HandSetTypeRepository.Update(entity);
            return new OperationResult(OperationResultType.Success, "更新成功");
        }

        public Componnent.Common.OperationResult Delete(int Id)
        {
            throw new NotImplementedException();
        }
    }
}
